/*
之前接口
/api/student/getStudent            get    查询所有
/api/student/getStudentById        get    查询单个
/api/student/getStudentByName      get    查询
/api/student/addStudent            post   添加
/api/student/removeStudent         delete 删除
/api/student/updateStudent         put    修改

REST Ful
/api/student               get     查询所有学生
/api/student/1001          get     查询单个学生
/api/student               post    添加
/api/student               put     修改
/api/student               delete  删除


*/
let axios = require('axios');
//配置公共baseURL
axios.defaults.baseURL = 'http://192.168.0.85:8090/';
//配置公共的请求头
axios.defaults.headers.common['token'] = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzMxMzk1MzE2LCJleHAiOjE3MzE0NDUzODF9.K1bQaD_Rn4KNQUlqxTLTP7m0Sf85zPGIkJxMlikBio67WPHCiD_SAdowuTTd_s21FmIOuVz5_hhbdcnxQUYhUQ";

// 获取验证码和client
// axios.get('http://192.168.0.85:8090/login/validate').then(result => {
//   console.log(result.data);
// }).catch(err => {
//   console.log(err);
// })

// 登录
// axios.post('http://192.168.0.85:8090/login', {
//   phone: "admin",
//   password: "123456",
//   validate: "k9YJ",
//   client: "73e1efab-8ed3-40a5-b2e7-efa512341937"
// }).then(result => {
//   console.log(result.data);
// }).catch(err => {
//   console.log(err);
// })
//eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzMxMzk1MzE2LCJleHAiOjE3MzE0NDUzODF9.K1bQaD_Rn4KNQUlqxTLTP7m0Sf85zPGIkJxMlikBio67WPHCiD_SAdowuTTd_s21FmIOuVz5_hhbdcnxQUYhUQ

// 查询所有员工
// axios.post('http://192.168.0.85:8090/employee/lists', {
//   'status': "在职",
//   'name': ""
// }, {
//   headers: {
//     'token': "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzMxMzk1MzE2LCJleHAiOjE3MzE0NDUzODF9.K1bQaD_Rn4KNQUlqxTLTP7m0Sf85zPGIkJxMlikBio67WPHCiD_SAdowuTTd_s21FmIOuVz5_hhbdcnxQUYhUQ"
//   }
// }).then(result => {
//   console.log(result.data);
// }).catch(err => {
//   console.log(err);
// })

// 修改员工
// axios({
//   url: "/employee/update",
//   method: 'put',
//   data: {
//     "id": 66,
//     "name": "侯帅康",
//     "roleId": 8,
//     "hiredate": "2021-01-01 08:02:03"
//   }
// }).then(result => {
//   console.log(result.data);
// }).catch(err => {
//   console.log(err);
// })
//根据id获取员工
axios({
  url: "/employee/get/65",
  method: 'get',
}).then(result => {
  console.log(result.data);
}).catch(err => {
  console.log(err);
})


